function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
const id = getQueryString('id')
console.log(id)

$.ajax({

    url:'./php/xiangqing.php',
    type:'POST',
    data:{
        id:id
    },
    dataType:'json',
    success:function(res){
        console.log(res)
      let str=''
      res.forEach(elem => {
          str+=`
           <div class="layout-top">
          <div class="top-left">
              <div class="djinfobox  flex">
                  <div class="goods-img ">
                      <img src="${elem.img}" alt="">
                      <div class="comico btn-goods-zoom "></div>
                      <div class="comico btn-goods-fav ">收藏商品</div>
                  </div>
                  <div class="goodsbuy-box">
                      <h2 class="goods-name">
                          <span class="fl name">${elem.name}</span>
                      </h2>
                      <div class="comico goods-bg">
                          <dl class="flex">
                              <dt class=" pt10">Q币价：</dt>
                              <dd class="txt-line pt10">
                                  <span>${elem.qprice}</span>
                                  <span>&nbsp;Q币</span>
                              </dd>
                          </dl>
                          <dl class="flex">
                              <dt class="fl">微信价：</dt>
                             <dd class="fl">
                                 <span class="goods-price orange">￥${elem.vprice}</span>
                             </dd>
                         </dl>
                      </div>
                      <dl class="pt18 flex">
                          <dt>期限：</dt>
                          <dd id="use_date">永久</dd>
                      </dl>
                      <div class="flex jiaru">
                          <a href="" class="btnico btn-goods-cart btn-com" title="加入购物车">加入购物车</a>
                          <a href="" class="btnico btn-goods-handsel btn-blue" title="赠送">赠送</a>
                      </div>
                  </div>
                 
              </div>
              
           </div>
      </div>
      <div class="layout-button">
         <div class="comico info-nav ">
          <a href="javascript:;" class="focus" >商品详情</a>
          <a href="javascript:;" class="mobile" id="">
              手机购买<i class="comico i-code"></i>
              <div class="codeimg">
                  <img src="https://js01.daoju.qq.com/common/images/channel/revision/lol/code.png" width="166" height="174" alt="二维码">
              </div>
          </a>
         </div>
         <div class="goods_tab">
          <p class="dj-detail">${elem.name}</p>
         </div>
      </div>
</div>
</div> 
          `
      });
      $('.layout-right').append(str)
    }
    
})